/**
 * Copyright (c) 2019-2029, wwww.kiwipeach.cn (liuburu@qq.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * https://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package open.kiwipeach.autoconfigure.web.utils;

import org.apache.shiro.crypto.hash.SimpleHash;

/**
 * 描述：认证授权相关工具类
 *
 * @author kiwipeach
 * @since 2.0
 */
public class OauthUtil {

    /**
     * 加密accessToken
     *
     * @param userName 用户名
     * @return 返回访问token
     */
    public static String encryptAccessToken(String userName) {
        return new SimpleHash("SHA1", userName, "nice-blog-sys", 1024).toString();
    }

    public static void main(String[] args) {
        String kiwipeach = encryptAccessToken("KiWiPeach");
        System.out.println(kiwipeach);
        //第一次：973f0d95c9e310ce92bfcf9889803bf5752a7760
        //第二次：973f0d95c9e310ce92bfcf9889803bf5752a7760
    }

}